const mongoose = require('../fu/fu_db')

// 商品类别的数据模型
const rui_ShopTypeSchema = new mongoose.Schema({
    title: String,
})

// 商品的数据模型
const rui_ShopSchema = new mongoose.Schema({
    title: String,
    image: String,
    integral: Number,
    detail_image: Array,
    like: Number,
    follow: Number,
    freight: Number,
    shop_type: {
        type: mongoose.Types.ObjectId,
        ref: 'rui_shop_type'
    },
    data: Number
})

// 地址的数据模型
const rui_addrSchema = new mongoose.Schema({
    addr: String,
    detail_addr: String,
    name: String,
    phone: String,
    default: {
        type: Boolean,
        default: false
    },
    title: {
        type: mongoose.Types.ObjectId,
        ref: 'rui_place',
    }
})

// 详细地点的数据模型
const rui_placeSchema = new mongoose.Schema({
    title: String,
})


// 评论的数据模型
const rui_commentSchema = new mongoose.Schema({
    title: String,
})

const rui_ShopModel = mongoose.model('rui_Shop', rui_ShopSchema, 'rui_Shop')
const rui_addrModel = mongoose.model('rui_addr', rui_addrSchema, 'rui_addr')
const rui_placeModel = mongoose.model('rui_place', rui_placeSchema, 'rui_place')
const rui_ShopTypeModel = mongoose.model('rui_shop_type', rui_ShopTypeSchema, 'rui_shop_type')
const rui_commentModel = mongoose.model('rui_comment', rui_commentSchema, 'rui_comment')

module.exports = {
    rui_ShopModel,
    rui_addrModel,
    rui_placeModel,
    rui_ShopTypeModel,
    rui_commentModel
}